package org.oslims.domain;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;

import com.google.gwt.validation.client.NotEmpty;

@Entity
public class SampleType extends AbstractBaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4910801937483222751L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	@ManyToMany(targetEntity = Analysis.class)
	@OrderBy("name")
	private List<Analysis> possibleAnalysis = new ArrayList<Analysis>();

	@NotEmpty
	private String name;

	@OneToMany(mappedBy = "sampleType")
	private List<AbstractSample> samples = new ArrayList<AbstractSample>();

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String sampleType) {
		this.name = sampleType;
	}

	public void setSamples(List<AbstractSample> samples) {
		this.samples = samples;
	}

	public List<AbstractSample> getSamples() {
		return samples;
	}

	public void setPossibleAnalysis(List<Analysis> possibleAnalysis) {
		this.possibleAnalysis = possibleAnalysis;
	}

	public List<Analysis> getPossibleAnalysis() {
		return possibleAnalysis;
	}

	public String toString() {
		return this.name;
	}

}
